import { createApp } from "vue";
import App from "./App.vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
// 国际化配置
import zhCN from "element-plus/es/locale/lang/zh-cn";
// svg 图标 配置项
import "virtual:svg-icons-register";
// 引入全局组件
import globalComponents from "@/components";
// 引入模板的全局样式
import "@/styles/index.scss";
// 引入路由
import router from "@/router";
// 引入pinia
import pinia from "@/store";
// 暗黑模式
import "element-plus/theme-chalk/dark/css-vars.css";

const app = createApp(App);
// 注册全局组件
app.use(globalComponents);
// 注册 element-plus
app.use(ElementPlus, {
  locale: zhCN,
});
// 注册路由
app.use(router);
// 引入路由鉴权的守卫
import "@/permission";
// 引入自定义指令
import { isHasButton } from "@/directive/has.ts";
isHasButton(app);

// 安装一下pinia
app.use(pinia);

app.mount("#app");
